home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #11 / Amiga Plus CD - 2004 - No. 11.iso / AmiSoft / Gfx / show / WallpaperView.lha / WallpaperViewer.rexx < prev    next >
OS/2 REXX Batch file  |  2004-08-09  |  5KB  |  162 lines

  1. /* 
  2.   WallpaperViewer by Mario (AMario@wp.pl) 
  3.   Do not publish modyfied code!
  4.   $VER: WallpaperViewer 1.2 
  5. */
  6.  
  7. signal on halt
  8. signal on break_c
  9.  
  10. call init
  11. call createApp
  12. call handleApp
  13.  
  14. /***********************************************************************/
  15. init: procedure
  16.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  17.     if AddLibrary("rexxsupport.library","rxmui.library","rxwb.library")~=0 then exit
  18.     call ProgDir()
  19.     return
  20. /***********************************************************************/
  21. handleApp: procedure
  22.     ctrl_c=2**12
  23.     s=0
  24.     do forever
  25.         call handle("APP","H",s)
  26.         do i=0 to h.num-1
  27.             if h.i="QUIT" then exit
  28.             interpret h.i 
  29.         end
  30.         call getattr("win","title","nazwaold")
  31.         if SelectedIcon()~=nazwaold then call Refreshnij
  32.         if and(s,ctrl_c)~=0 then exit
  33.         call delay(1)
  34.     end
  35.    return
  36. /***********************************************************************/
  37. createApp: procedure
  38.  
  39. app.Title="WallpaperViewer"
  40. app.Description="Views and installs wallpapers"
  41. app.Base="WALLPAPERV"
  42. app.SubWindow="win"
  43. win.ID="MAIN"
  44. win.Title="WallpaperViewer"
  45. win.HelpNode="Window"
  46. win.Contents="group"
  47.  
  48.  
  49. group.0=text("status"," Select icon in WB... ")
  50. group.1=button("su","_Screen (use)")
  51. group.2=button("ss","S_creen (save)")
  52. group.3=button("wu","_Window (use)")
  53. group.4=button("ws","W_indow (save)")
  54. group.5="cyc"
  55. cyc.class="cycle"
  56. cyc.entries="Small view|Big view|Wallpaper!|Freeze view"
  57. cyc.activeentry="Small view"
  58. group.6="pic"
  59. pic.class="gfxpic"
  60. pic.transparent=1
  61. call NewObj("Application","app")
  62.  
  63. call Notify("win","CloseRequest",1,"app","ReturnID","quit")
  64. call Notify("su","Pressed",0,"app","Return","call SUse")
  65. call Notify("ss","Pressed",0,"app","Return","call SSave")
  66. call Notify("wu","Pressed",0,"app","Return","call WUse")
  67. call Notify("ws","Pressed",0,"app","Return","call WSave")
  68.  
  69. call set("win","Open",1)
  70.  
  71. return
  72. /***********************************************************************/
  73. Refreshnij: procedure
  74.   call getattr("cyc","activeentry","tryb")
  75.   if tryb="Freeze view" then return
  76.   call getattr("win","title","nazwa")
  77.   if nazwa="WallpaperViewer" then return
  78.   call domethod("group",initchange)
  79.   call set("status","contents","        Loading...        ")
  80.   call domethod("group",exitchange)
  81.   call domethod("group",initchange)
  82.   call set("pic","source",nazwa)
  83.   call getattr("pic","imagewidth","szer")
  84.   call getattr("pic","imageheight","wys")
  85.   if szer<450 & tryb="Big view" & szer>14 then 
  86.   do  
  87.     proc=45000%szer
  88.     call set("pic","scale",proc)
  89.   end
  90.   if szer>500 & tryb="Big view" then
  91.   do
  92.     proc=50000%szer
  93.     call set("pic","scale",proc)
  94.   end
  95.   if szer>280 & tryb="Small view" then
  96.   do
  97.     proc=28000%szer
  98.     call set("pic","scale",proc)
  99.   end
  100.   if tryb="Wallpaper!" & szer>1 then 
  101.   do
  102.     proc=15000%szer
  103.     call set("pic","scale",proc)
  104.   end
  105.   if szer>0 then 
  106.   do
  107.     call domethod("win","ScreenInfo","ekran")
  108.     call getattr("pic","scaledheight","swys")
  109.     if ((ekran.height-160)<swys)|(szer>100*wys ) then
  110.     do
  111.         call set("pic","source","")
  112.         call set("status","contents"," Too large picture...  ")
  113.         call domethod("group",exitchange)
  114.         return
  115.     end
  116.     call set("status","contents", szer "x" wys", Ready... ")
  117.   end
  118.   if szer=0 then call set("status","contents"," Select icon in WB... ")
  119.   if szer>149 & tryb="Wallpaper!" then call sUse
  120.   call domethod("group",exitchange)
  121.   return
  122. /***********************************************************************/
  123. SelectedIcon: procedure
  124.     call WBGetAttr('',"SELECTEDICONLIST","stem")
  125.     if stem.num>0 then nazwa=stem.0
  126.     if stem.num=0 then call getattr("win","title","nazwa")
  127.     if nazwa="STEM.0" then call getattr("win","title","nazwa")
  128.     call set("win","title",nazwa)
  129.     return nazwa
  130. /***********************************************************************/
  131. halt:
  132. break_c:
  133.     exit
  134. /***********************************************************************/
  135. SUse: procedure
  136.   call getattr("win","title","nazwa")
  137.   if nazwa="WallpaperViewer" then return
  138.   call getattr("pic","imagewidth","szer")
  139.   if szer<150 then return
  140.   address command 'C:NewWBPattern "'nazwa'"'
  141.   return
  142. /***********************************************************************/
  143. SSave: procedure
  144.   call getattr("win","title","nazwa")
  145.   if nazwa="WallpaperViewer" then return
  146.   call getattr("pic","imagewidth","szer")
  147.   if szer<150 then return
  148.   address command 'C:NewWBPattern "'nazwa'" save'
  149.   return
  150. /***********************************************************************/
  151. WUse: procedure
  152.   call getattr("win","title","nazwa")
  153.   if nazwa="WallpaperViewer" then return
  154.   address command 'C:NewWBPattern windows "'nazwa'"'
  155.   return
  156. /***********************************************************************/
  157. WSave: procedure
  158.   call getattr("win","title","nazwa")
  159.   if nazwa="WallpaperViewer" then return
  160.   address command 'C:NewWBPattern windows "'nazwa'" save'
  161.   return
  162. /***********************************************************************/